package com.woniuxy.main.service.imp;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.woniuxy.main.mapper.StudentMapper;
import com.woniuxy.main.mapper.UserMapper;
import com.woniuxy.main.pojo.Student;
import com.woniuxy.main.pojo.User;
import com.woniuxy.main.service.UserStudentService;

@Service
@Transactional
public class UserStudentServiceImp implements UserStudentService {

	@Resource
	private UserMapper userMapper;
	@Resource
	private StudentMapper studentMapper;

	public UserMapper getUserMapper() {
		return userMapper;
	}

	public void setUserMapper(UserMapper userMapper) {
		this.userMapper = userMapper;
	}

	public StudentMapper getStudentMapper() {
		return studentMapper;
	}

	public void setStudentMapper(StudentMapper studentMapper) {
		this.studentMapper = studentMapper;
	}

	@Override
	public int addStuInfo(User user, Student student) {
		int row = 0;
		studentMapper.addUserStuInfo(student);
		userMapper.addUserStuInfo(user);

		row = studentMapper.addUserStuInfo(student) + userMapper.addUserStuInfo(user);
		return row;
	}

}
